package com.livegoods.controller;

import com.livegoods.commons.pojo.LivegoodsResult;
import com.livegoods.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HouseController {


    @Autowired
    private HouseService houseService;

    /**
     * 初始化数据，MongoDB数据同步到ES
     *
     * @return
     */
    @RequestMapping("/init")
    public int init() {
        return houseService.init();
    }


    @GetMapping("/search")
    public LivegoodsResult search(String city,@RequestParam(name = "content") String keyword,int page,@RequestParam(defaultValue = "10") int size){
        return houseService.search(city,keyword,page,size);
    }

}
